<?php 
class registerAction extends sfAction{
	public function execute($request){
		$data['email']	= $request->getParameter('reg_email', '');
		$data['captcha']	= $request->getParameter('reg_captcha', '');
		$data['password'] = $request->getParameter('reg_password', '');
		$json = array('status' => '-1', 'message' => 'Mã bảo vệ chưa chính xác.');
		
		if(CaptchaHelper::isValidate($data['captcha'])){
			if(Members::register($data)){
				$member = Members::login($data);
				$json['status'] = '1';
				$json['message'] = 'Đăng ký thành công.';
			}
		}
		print_r(json_encode($json));
		return sfView::NONE;
	}
}